/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simplemetrosystem.model.Command.EditCommand;

import java.awt.Color;
import simplemetrosystem.control.ElementManager;
import simplemetrosystem.model.Command.Command;
import simplemetrosystem.model.Element.MetroLine;

/**
 *
 * @author Eric Qian
 */
public class EditLineCommand implements Command {

    /**
     * 
     * @param line
     * @param name
     * @param cName
     * @param status
     * @param color
     */
    public EditLineCommand(MetroLine line, String name, String cName, String status, Color color) {
        this.line = line;
        this.name = name;
        this.cName = cName;
        this.status = status;
        this.color = color;
        tempName = line.getName();
        tempCName = line.getChineseName();
        tempStatus = line.getStatus();
        tempColor = line.getColor();
    }

    public void execute() {
        ElementManager.getInstance().editLine(line, name, cName, status, color);
    }

    public void undo() {
        ElementManager.getInstance().editLine(
                line, tempName, tempCName, tempStatus, tempColor);
    }
    private MetroLine line;
    private String name;
    private String cName;
    private String status;
    private Color color;
    private String tempName;
    private String tempCName;
    private String tempStatus;
    private Color tempColor;
}
